import unittest
import radix


class MyTestCase(unittest.TestCase):
    def test_to_string(self):
        digit_chars = list("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")
        for i in range(-10000, 10000):
            for r in range(2, 37):
                im_back = int(radix.to_string(i, digit_chars[0:r]), r)
                self.assertEqual(i, im_back)

    def test_to_number_string(self):
        for i in range(-10000, 10000):
            for r in range(2, 11):
                im_back = int(radix.to_number_string(i, r), r)
                self.assertEqual(i, im_back)


if __name__ == '__main__':
    unittest.main()
